<template>
	<!--
    	作者：1550495493@qq.com
    	时间：2019-08-17
    	描述：项目信息
    -->
	<div class="Announcements">
		<div class="Website-visits">
			<div class="location">
				<div class="location-text fl">
					<img class="location-img fl" src="../../images/ProjectManager/projectInformation.png" />
					<p class="fr">项目信息</p>
				</div>
				<img class="biaotibg fl" src="../../images/home/biaotibg.png" />
			</div>
			<div class="search-box">
				<div class="fl">
					<label>项目名称：</label>
          <input name="search" class="search" type="text" autocomplete="off" v-model="search" />
          <input class="btn" type="button" value="搜索" @click="searchTodo" />
				</div>
			</div>
			<div class="PressRelease-list">
				<table>
					<thead>
						<tr>
							<th class="w300">项目名称</th>
							<th class="w300">发布基地</th>
							<th class="w100">合同开始时间</th>
							<th class="w100">合同结束时间</th>
							<th class="w80">项目总金额</th>
							<th class="w100">项目已用金额</th>
							<th class="w80">项目类型</th>
							<th class="w80">项目详情 </th>
              <th class="w80">项目状态 </th>
							<th class="w80">任务书</th>
							<th class="w80">任务书状态 </th>
              <th class="w80">中期报告</th>
              <th class="w100">中期报告状态</th>
              <th class="w80">结题报告</th>
              <th class="w100">结题报告状态</th>
						</tr>
					</thead>
					<tbody>
            <tr v-if="projectList.length == 0">
              <td colspan="15" class="center">暂无数据！</td>
            </tr>
            <tr v-for="(project,index) in projectList"  :class="index==curIndex?'activeBg':''" @click="choosed(index)">
							<td :title="project.name"><span class="show-twoline">{{project.name}}</span></td>
							<td :title="project.areasName"><span class="show-twoline">{{project.areasName}}</span></td>
							<td>{{formatData(project.contractBeginTime)}}</td>
							<td>{{formatData(project.contractEndTime)}}</td>
              <td><template v-if="project.initiationAuditStatus == 2">{{project.budgetAmount}}</template></td>
							<td>
                <template v-if="project.closureAuditStatus == 2 && project.closurePracticalAmount != null">
                  {{project.closurePracticalAmount}}
                </template>
                <template v-else-if="project.metaphaseAuditStatus == 2 && project.practicalAmount != null">
                  {{project.practicalAmount}}
                </template>
                <!--{{project.closurePracticalAmount != null ? project.closurePracticalAmount : project.practicalAmount}}-->
              </td>
							<td>{{project.type == 1 ? "横向项目" : "研究院项目"}}</td>
              <td><input @click="projectDetails(project.id)" type="button" value="查看" class="delete write" /></td>
              <td>{{project.areasStatus == 6 || project.areasStatus == 3 ? "无效" : "有效"}}</td>
              <td>
                <template v-if="project.processStatus == 2 || project.processStatus == 3 || project.processStatus == 4">
                  <template v-if="project.initiationAuditStatus == 1 && project.initiationUploadStatus == 0">
                    <input @click="showUploadInitiation(project)" type="button" value="上传" class="delete write" v-if="project.areasStatus == 6 || project.areasStatus == 3 ? false : true"/>
                  </template>
                  <template v-else-if=" project.initiationAuditStatus == 3">
                    <input @click="showUploadInitiation(project)" type="button" value="重新上传" class="delete write" v-if="project.areasStatus == 6 || project.areasStatus == 3 ? false : true"/>
                  </template>
                  <template v-else>
                    <input type="button" value="查看" class="delete write" @click="preview(project.taskBookUrl)"/>
                  </template>
                </template>
              </td>
							<td>
                <template v-if="project.processStatus == 2 || project.processStatus == 3 || project.processStatus == 4">
                  <!--立项审核状态（1：待审核；2：审核通过；3：审核不通过）-->
                  <template v-if="project.initiationAuditStatus == 1">
                    <template v-if="project.initiationUploadStatus == 1">
                      待审核
                    </template>
                    <template v-else>
                      未上传
                    </template>
                  </template>
                  <template v-else-if="project.initiationAuditStatus == 2">
                    已通过
                  </template>
                  <template v-else-if="project.initiationAuditStatus == 3">
                    <input @click="auditDetailsShow(project.initiationAuditMsg, project.initiationAuditEnclosureUrl)" type="button" value="不通过" class="write delete" />
                    <!--不通过-->
                  </template>
                </template>
              </td>

              <td>
                <template v-if="project.processStatus == 3 || project.processStatus == 4">
                  <template v-if="project.metaphaseAuditStatus == 1 && project.metaphaseUploadStatus == 0">
                    <input @click="showUploadMetaphase(project)" type="button" value="上传" class="delete write" v-if="project.areasStatus == 6 || project.areasStatus == 3 ? false : true"/>
                  </template>
                  <template v-else-if="project.metaphaseAuditStatus == 3">
                    <input @click="showUploadMetaphase(project)" type="button" value="重新上传" class="delete write" v-if="project.areasStatus == 6 || project.areasStatus == 3 ? false : true"/>
                  </template>
                  <template v-else>
                    <input type="button" value="查看" class="delete write" @click="preview(project.metaphaseReportUrl)"/>
                  </template>
                </template>
              </td>
              <td>
                <template v-if="project.processStatus == 3 || project.processStatus == 4">
                  <!--中期审核状态（1：待审核；2：审核通过；3：审核不通过）-->
                  <template v-if="project.metaphaseAuditStatus == 1">
                    <template v-if="project.metaphaseUploadStatus == 1">
                      待审核
                    </template>
                    <template v-else>
                      未上传
                    </template>
                  </template>
                  <template v-else-if="project.metaphaseAuditStatus == 2">
                    已通过
                  </template>
                  <template v-else-if="project.metaphaseAuditStatus == 3">
                    <input @click="auditDetailsShow(project.metaphaseAuditMsg, project.metaphaseAuditEnclosureUrl)" type="button" value="不通过" class="write delete" />
                    <!--不通过-->
                  </template>
                </template>
              </td>

              <td>
                <template v-if="project.processStatus == 4">
                  <template v-if="(project.closureAuditStatus == 1  && project.closureUploadStatus == 0) || project.closureAuditStatus == 4">
                    <input @click="showUploadClosure(project)" type="button" value="上传" class="delete write" v-if="project.areasStatus == 6 || project.areasStatus == 3 ? false : true"/>
                  </template>
                  <template v-else>
                    <input type="button" value="查看" class="delete write" @click="preview(project.closureMaterialUrl)"/>
                  </template>
                </template>
              </td>
              <td>
                <template v-if="project.processStatus == 4">
                  <!--结题审核状态（1：待审核；2：审核通过；3：审核不通过，4：限期整改）-->
                  <template v-if="project.closureAuditStatus == 1">
                    <template v-if="project.closureUploadStatus == 1">
                      待审核
                    </template>
                    <template v-else>
                      未上传
                    </template>
                  </template>
                  <template v-else-if="project.closureAuditStatus == 2">
                    已通过
                  </template>
                  <template v-else-if="project.closureAuditStatus == 3">
                    <!--不通过-->
                    <input @click="auditDetailsShow(project.closureAuditMsg, project.closureAuditEnclosureUrl)" type="button" value="不通过" class="write delete" />
                  </template>
                  <template v-else-if="project.closureAuditStatus == 4">
                    <input @click="auditDetailsShow2(project.closureAuditMsg, project.closureAuditEnclosureUrl, project.deadlineBeginTime, project.deadlineEndTime)" type="button" value="限期整改" class="write delete" />
                  </template>
                </template>
              </td>
						</tr>
					</tbody>
				</table>

			</div>
			<!--total  数据总数   size  一页多少条数据   page  当前页码    changge 返回当前选择的页码  改变一页显示条 child  返回值就是一页显示条数  -->
				<pageination :total="total" :size="size" :page="page" :changge="pageFn" @child="obtainChild"></pageination>
		</div>

    <!-- 上传项目立项-模态框-->
    <div v-show="uploadInitiation" class="tenant-model">
      <div class="tenant-model-content demandModel upload-task">
        <header class="tenant-model-header">
          <h3>上传任务书</h3>
          <span @click="closeModel" class="closeModel">×</span>
        </header>
        <div class="tenant-model-body">
          <div class="search-contain">
            <!--模态框内容板块-->
            <form class="form-box" id="uploadInitiationForm">

              <div class="form-line input-required">
                <label>项目总金额：</label>
                <div class="input-box">
                  <input name="budgetAmount" class="budget-amount" v-model="projectInitiation.budgetAmount" autocomplete="off">元
                </div>
              </div>
              <div class="form-line arrival-account">
                <label class="textarea-label">到账情况：</label>
                <div class="input-box">
                  <select name="accountStatus" v-model="projectInitiation.accountStatus">
                    <option value="1">已到账</option>
                    <option value="0">未到账</option>
                  </select>
                </div>
              </div>
               <div class="form-line">
                <label>任务书模板：</label>
                <input type="button" value="下载" class="delete write" @click="downloadTemplate(5)"/>
              </div>
              <input type="reset" style="display: none"/>
              <div class="form-line input-required">
                <label>附件上传：</label>
                <!--<div class="input-box">-->
                  <input type="file" id="taskBookFile" accept=".txt,.rar,.zip,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.exe,image/*" @change="idFrontImg($event)" style="display: none;" />
                  <input type="button" value="上传附件" class="delete write" @click="touchOffIdInput(1)"/>
                  <input type="button" value="删除附件" class="delete write" @click="deleteEnclosure()"  v-if="FileUpload.length"/>
                  <span class="taskBookUrl-error"  v-if="!FileUpload.length&&!uploadFile">请上传任务书！</span>
                  <ul class="img-box" v-if="FileUpload.length">
                    <li v-for="item in FileUpload">{{item}}</li>
                  </ul>
                  <input type="hidden" name="taskBookUrl" v-model="projectInitiation.taskBookUrl">
                <!--</div>-->
              </div>


            </form>
          </div>
        </div>
        <footer class="tenant-model-footer">
          <button class="determine" @click="saveProjectInitiation">确定</button>
        </footer>
      </div>
    </div>

    <!-- 上传项目中期-模态框-->
    <div v-show="uploadMetaphase" class="tenant-model">
      <div class="tenant-model-content demandModel  upload-task conclusion">
        <header class="tenant-model-header">
          <h3>上传中期报告</h3>
          <span @click="closeModel" class="closeModel">×</span>
        </header>
        <div class="tenant-model-body">
          <div class="search-contain">
            <!--模态框内容板块-->
            <form class="form-box" id="uploadMetaphaseForm">
            	<div class="form-line">
                <label>项目总金额：</label>
                <span>{{projectMetaphase.budgetAmount}}元</span>
                <!--<div class="input-box">
                  <input name="budgetAmount" v-model="projectMetaphase.budgetAmount" readonly>
                </div>-->
              </div>
              <div class="form-line input-required">
                <label>项目已用金额：</label>
                <div class="input-box amount-used">
                  <input name="practicalAmount" v-model="projectMetaphase.practicalAmount" autocomplete="off">元
                </div>
              </div>
              <input type="reset" style="display: none"/>
              <div class="form-line">
                <label>中期报告模板：</label>
                <input type="button" value="下载" class="delete write" @click="downloadTemplate(6)"/>
              </div>
              <div class="form-line">
                <label>附件上传：</label>
               <!-- <div class="input-box">-->
                  <input type="file" id="metaphaseReportFile" accept=".txt,.rar,.zip,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.exe,image/*" @change="idFrontImg($event)" style="display: none;" />
                  <input type="button" value="上传附件" class="delete write" @click="touchOffIdInput(2)"/>
                  <input type="button" value="删除附件" class="delete write" @click="deleteEnclosure()" v-if="FileUpload.length"/>
                  <ul class="img-box" v-if="FileUpload.length">
                    <li v-for="item in FileUpload">{{item}}</li>
                  </ul>
                  <input type="hidden" name="metaphaseReportUrl" v-model="projectMetaphase.metaphaseReportUrl">
               <!-- </div>-->
              </div>

            </form>
          </div>
        </div>
        <footer class="tenant-model-footer">
          <button class="determine" @click="saveProjectMetaphase">确定</button>
        </footer>
      </div>
    </div>

    <!-- 上传项目结题-模态框-->
    <div v-show="uploadClosure" class="tenant-model">
      <div class="tenant-model-content demandModel  upload-task conclusion">
        <header class="tenant-model-header">
          <h3>上传结题报告</h3>
          <span @click="closeModel" class="closeModel">×</span>
        </header>
        <div class="tenant-model-body">
          <div class="search-contain">
            <!--模态框内容板块-->
            <form class="form-box" id="uploadClosureForm">
               <div class="form-line">
                <label>项目总金额：</label>
                <span>{{projectClosure.budgetAmount}}元</span>
                <!--<div class="input-box">
                  <input name="budgetAmount" v-model="projectClosure.budgetAmount" readonly>元
                </div>-->
              </div>
              <div class="form-line input-required">
                <label>项目已用金额：</label>
                <div class="input-box amount-used">
                  <input name="closurePracticalAmount" v-model="projectClosure.closurePracticalAmount" autocomplete="off">元
                </div>
              </div>
              <input type="reset" style="display: none"/>
              <div class="form-line">
                <label>结题报告模板：</label>
                	<input type="button" value="下载" class="delete write" @click="downloadTemplate(7)"/>
              </div>
              <div class="form-line input-required">
                <label>附件上传：</label>
                <!--<div class="input-box">-->
                  <input type="file" id="closureMaterialFile" accept=".txt,.rar,.zip,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.exe,image/*" @change="idFrontImg($event)" style="display: none;" />
                  <input type="button" value="上传附件" class="delete write" @click="touchOffIdInput(3)"/>
                  <input type="button" value="删除附件" class="delete write" @click="deleteEnclosure()"  v-if="FileUpload.length"/>
                  <span class="taskBookUrl-error"  v-if="!FileUpload.length&&!uploadFile2">请上结题报告！</span>
                  <ul class="img-box" v-if="FileUpload.length">
                    <li v-for="item in FileUpload">{{item}}</li>
                  </ul>
                  <input type="hidden" name="closureMaterialUrl" v-model="projectClosure.closureMaterialUrl">
               <!-- </div>-->
              </div>

            </form>
          </div>
        </div>
        <footer class="tenant-model-footer">
          <button class="determine" @click="saveProjectClosure">确定</button>
        </footer>
      </div>
    </div>

    <!-- 项目详情-模态框-->
    <div v-if="projectDetailsModelShow" class="tenant-model">
      <div class="tenant-model-content look-project">
        <header class="tenant-model-header">
          <h3>查看项目详情</h3>
          <span @click="closeModel" class="closeModel">×</span>
        </header>
        <div class="tenant-model-body">
          <div class="search-contain">
            <!--模态框内容板块-->
            <div class="rork">
              <div>基地名称：<p>{{project.areasName}}</p></div>
              <div>项目名称：<p>{{project.name}}</p></div>
              <p>项目类型：{{project.type == 1 ? "横向项目" : "研究院项目"}}</p>
              <div>项目简介：<p>{{project.introduction}}</p></div>
              <p>项目需求说明书：<a @click="preview(project.demandBookUrl)" class="deletes write">预览</a></p>
            </div>
          </div>
        </div>
        <!--<footer class="tenant-model-footer">
          <button class="determine" @click="closeModel">返回</button>
        </footer>-->
      </div>
    </div>

    <!-- 审核详情-模态框-->
    <div v-if="auditDetails" class="tenant-model">
      <div class="tenant-model-content Application  not-pass audit-details">
        <header class="tenant-model-header">
          <h3>查看不通过原因</h3>
          <span @click="closeModel" class="closeModel">×</span>
        </header>
        <div class="tenant-model-body">
          <div class="search-contain">
            <!--模态框内容板块-->
            <div class="rork">
              不通过原因：
              <div>{{auditObj.msg}}</div>
            </div>
            <p>附件：<input @click="preview(auditObj.enclosureUrl)" type="button" value="预览" class="write delete" /></p>
          </div>
        </div>
      </div>
    </div>

    <!-- 审核限期整改详情-模态框-->
    <div v-if="auditDetails2" class="tenant-model">
      <div class="tenant-model-content Application  not-pass audit-details">
        <header class="tenant-model-header">
          <h3>查看限期整改原因</h3>
          <span @click="closeModel" class="closeModel">×</span>
        </header>
        <div class="tenant-model-body">
          <div class="search-contain">
            <!--模态框内容板块-->
            <div class="rork">
              <label>开始时间：</label>
              {{formatData(auditObj.deadlineBeginTime)}}
            </div>
            <div class="rork">
              <label>结束时间：</label>
              {{formatData(auditObj.deadlineEndTime)}}
            </div>
            <div class="rork">
              限期整改原因：
              <div>{{auditObj.msg}}</div>
            </div>
            <p>附件：<input @click="preview(auditObj.enclosureUrl)" type="button" value="预览" class="write delete" /></p>
          </div>
        </div>
      </div>
    </div>

	</div>
</template>
<script src="./ProjectFormation.js"></script>

<style scoped>
	@import "ProjectFormation.css"
</style>
